import abstract_.Strategy;
import impl.StrategyA;
import impl.StrategyB;
import impl.StrategyC;

import java.util.HashMap;
import java.util.Map;

public class StrategyFactory {

    // 定义策略map缓存
    private static final Map<String, Strategy> strategies = new HashMap<>();
    
    static {
        strategies.put("buyOneGetOne", new StrategyA());
        strategies.put("discount", new StrategyC());
        strategies.put("fullReduction", new StrategyB());
    }

    public static Strategy getStrategy(StrategyEnum type) {
        return strategies.get(type.getCode());
    }
}
